﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Member_AreaList.aspx.cs" Inherits="Youz.CreditRepay.Manage.Sys.Member_AreaList" %>

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-align-justify"></i><span style="font-size: 16px; padding-right: 15px;">代理商管理</span></h2>
                <div class="panel-actions"></div>
            </div>
            <div class="panel-body">
                <div class="alert alert-danger" style="display: none;">
                    <button type="button" class="close" data-dismiss="alert">×</button><strong><i class="fa fa-warning"></i></strong><span class="content"></span>
                </div>
                <form class="form-inline">
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc">交易帐号：</label>
                        <input type="text" id="AreaName" maxlength="45" name="AreaName" class="form-control" >
                    </div>
                    <button type="button" id="btnQuery" name="btnQuery" class="btn btn-default btn-ar btn-primary">
                        <i class="fa fa-search "></i>
                        <%: R(LanguageModule.M_Common, "Query") %>
                    </button>
                </form>
                <div class="form-group"></div>
                <div class="col-sm-12">
                    <div class="form-group">
                        <a href="#" class="btn btn-info" onclick="loadPage('Sys/Member_AreaItem.aspx')"><i class="fa fa-plus"></i>
                            <%: R(LanguageModule.M_Common, "Add") %></a>
                        <a href="#" class="btn btn-info" id="btnEdit"><i class="fa fa-edit "></i>
                            <%: R(LanguageModule.M_Common, "Edit") %></a>
                        <a href="#" class="btn btn-info" id="btnDelete"><i class="fa fa-trash-o "></i>
                            <%: R(LanguageModule.M_Common, "Delete") %></a>
                    </div>
                </div>
                <table id="table" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%"></table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var dt;

    $(function () {

        dt = $('#table').DataTable({
            "ajax": {
                "url": 'Sys/Handlers/Member_AreaHandler.ashx?type=list',
                "type": "POST",
                "dataSrc": "data",
                "data": function (d) {
                    d.AreaName = $('#AreaName').val();
                }
            },
            "columns": [
                    { "data": 'RowIndex', "title": "#" },
                    { "data": 'AreaName', "title": "交易帐号" },
                    { "data": 'AgentsAccount', "title": "代理商后台帐号" },
                    { "data": 'Memo', "title": "<%: R(LanguageModule.Sys_Config, "Memo", "备注") %>" },
                    { "data": 'Creator', "title": "<%: R(LanguageModule.Sys_Config, "Creator", "创建人") %>" },
                    { "data": 'CreateTime', "title": "<%: R(LanguageModule.Sys_Config, "CreateTime", "创建时间") %>" }
            ]
        });


        $('#btnDelete').click(function () {
            if ($("#table").find('tr.selected').length == 1) {

                jconfirm("<%: R(LanguageModule.M_Common, "DeleteConfirm") %>", function () {
                    $.post("Sys/Handlers/Member_AreaHandler.ashx?type=delete", { AreaID: dt.row('.selected').data().AreaID }, function (data) {
                        if (data) {
                            if (data.isSuccess) {
                                dt.ajax.reload();
                            } else {
                                jalert(data.message);
                            }
                        }
                    }, "json");
                });
            }
            else {
                jalert("<%: R(LanguageModule.M_Common, "SelectRecord") %>");
            }
        });


        $('#btnEdit').click(function () {
            if ($("#table").find('tr.selected').length == 1) {

                loadPage("Sys/Member_AreaItem.aspx?AreaID=" + dt.row('.selected').data().AreaID);
            }
            else {
                jalert("<%: R(LanguageModule.M_Common, "SelectRecord") %>");
            }
        });

        $('#btnQuery').click(function () {
            dt.ajax.reload();
        });
    });

</script>
